package OIandFile;

import java.util.Scanner;

public class Match {
    public static void main(String[] args) {
        Scanner input =new Scanner(System.in);
        System.out.println("请输入计算的数字：");
        int number= input.nextInt();
        System.out.println(test(number));
        System.out.println("----------------------------------");
        System.out.println(test1(3));

    }
    //求n!的和
    public static int test(int n) {
        if (n == 1) {
            return 1;
        } else {
            return n*test(n-1);

        }
    }
    //求1到n的和
    public  static  int test1(int n){
        if(n==1){
            return 1;
        }else {
            return  n+test1(n-1);
        }
    }
}
